package com.kclm.se.proxy.jdk;

import com.kclm.se.proxy.UserDao;
import com.kclm.se.proxy.UserDaoImpl;

public class TestJdkProxy {

	public static void main(String[] args) {
		//1.创建目标对象
		UserDao userDao = new UserDaoImpl();
		//2. 通过ProxyFactory来获取目标对象的代理对象【JDK代理】
		//UserDao proxy = (UserDao) ProxyFactory.getProxyInstance(userDao);
		UserDao proxy = ProxyFactory.getProxyInstance(userDao);
		//3. 调用方法
		proxy.save("张三");
		//
		System.out.println(userDao.getClass());
		System.out.println(proxy.getClass());
	}
}
